//
//  Device+Ex.swift
//  APP
//
//  Created by LXF on 2018/1/25.
//  Copyright © 2018年 Rdxer. All rights reserved.
//

import Foundation
import Device
import AudioToolbox

public extension Device{
    public static func lightVibration(){
        var lessThan7 = false
        switch Device.version() {
        case .iPhone4,
             .iPhone4S,
             .iPhone5,
             .iPhone5C,
             .iPhone5S,
             .iPhone6,
             .iPhone6Plus,
             .iPhone6S,
             .iPhone6SPlus,
             .iPhoneSE:
                lessThan7 = true
            default: lessThan7 = false
        }
        
        if #available(iOS 10.0, *), Device.isPhone() && lessThan7 == false {
            UIImpactFeedbackGenerator
                .init(style: .light).do({
                    $0.prepare()
                    $0.impactOccurred()
                })
        } else {
            AudioServicesPlaySystemSound(1520)
        }
    }
}
